<?php


namespace App\Http\Controllers\Api;
use App\Models\Config;

class ConfigController extends BaseController
{

    public function init() {
        $this->_check();
        $site = Config::getSiteVal();
        $appoint = $site['appoint_basic'];
        $max_date = max(array_column($appoint, 'end_at'));
        //判断当前是否大于最后面日期，如果大于向后面计算一天
        $tomorrow = date("Y-m-d",strtotime("+1 day"));
        if (time() > strtotime($max_date)) {
            $site = Config::getSiteVal($tomorrow);
        }

        $user = $this->getUser();
        return $this->success(compact('site', 'user'));
    }

}

